package com.aspose.cells.a.c;

class za {
   private final byte[] a = new byte[64];
   private int b;
   private long c;
   private int[] d = new int[4];
   private int[] e = new int[16];

   za() {
      this.a();
   }

   public void a() {
      this.b = 0;
      this.c = 0L;
      this.d[0] = 1732584193;
      this.d[1] = -271733879;
      this.d[2] = -1732584194;
      this.d[3] = 271733878;
   }

   public byte[] b() {
      byte[] var1 = new byte[16];
      this.b(var1, 0, 16);
      return var1;
   }

   private void a(byte[] var1, int var2) {
      for(int var3 = 0; var3 < 4; ++var3) {
         for(int var4 = 0; var4 < 4; ++var4) {
            var1[var2 + var3 * 4 + var4] = (byte)(this.d[var3] >>> 8 * var4);
         }
      }

   }

   private void b(byte[] var1, int var2, int var3) {
      this.a[this.b++] = -128;
      byte var4 = 8;
      int var5 = 64 - var4;
      if (this.b > var5) {
         while(true) {
            if (this.b >= 64) {
               this.b(this.a, 0);
               this.b = 0;
               break;
            }

            this.a[this.b++] = 0;
         }
      }

      while(this.b < var5) {
         this.a[this.b++] = 0;
      }

      long var6 = this.c * 8L;

      for(int var8 = 0; var8 < 64; var8 += 8) {
         this.a[this.b++] = (byte)((int)(var6 >>> var8));
      }

      this.b(this.a, 0);
      this.a(var1, var2);
   }

   public void a(byte[] var1, int var2, int var3) {
      int var4;
      for(this.c += (long)var3; var3 >= (var4 = 64 - this.b); this.b = 0) {
         System.arraycopy(var1, var2, this.a, this.b, var4);
         this.b(this.a, 0);
         var3 -= var4;
         var2 += var4;
      }

      System.arraycopy(var1, var2, this.a, this.b, var3);
      this.b += var3;
   }

   private void b(byte[] var1, int var2) {
      int var3;
      for(var3 = 0; var3 < 16; ++var3) {
         this.e[var3] = var1[var2++] & 255 | (var1[var2++] & 255) << 8 | (var1[var2++] & 255) << 16 | (var1[var2++] & 255) << 24;
      }

      var3 = this.d[0];
      int var4 = this.d[1];
      int var5 = this.d[2];
      int var6 = this.d[3];
      var3 = this.a(var3, var4, var5, var6, this.e[0], 3);
      var6 = this.a(var6, var3, var4, var5, this.e[1], 7);
      var5 = this.a(var5, var6, var3, var4, this.e[2], 11);
      var4 = this.a(var4, var5, var6, var3, this.e[3], 19);
      var3 = this.a(var3, var4, var5, var6, this.e[4], 3);
      var6 = this.a(var6, var3, var4, var5, this.e[5], 7);
      var5 = this.a(var5, var6, var3, var4, this.e[6], 11);
      var4 = this.a(var4, var5, var6, var3, this.e[7], 19);
      var3 = this.a(var3, var4, var5, var6, this.e[8], 3);
      var6 = this.a(var6, var3, var4, var5, this.e[9], 7);
      var5 = this.a(var5, var6, var3, var4, this.e[10], 11);
      var4 = this.a(var4, var5, var6, var3, this.e[11], 19);
      var3 = this.a(var3, var4, var5, var6, this.e[12], 3);
      var6 = this.a(var6, var3, var4, var5, this.e[13], 7);
      var5 = this.a(var5, var6, var3, var4, this.e[14], 11);
      var4 = this.a(var4, var5, var6, var3, this.e[15], 19);
      var3 = this.b(var3, var4, var5, var6, this.e[0], 3);
      var6 = this.b(var6, var3, var4, var5, this.e[4], 5);
      var5 = this.b(var5, var6, var3, var4, this.e[8], 9);
      var4 = this.b(var4, var5, var6, var3, this.e[12], 13);
      var3 = this.b(var3, var4, var5, var6, this.e[1], 3);
      var6 = this.b(var6, var3, var4, var5, this.e[5], 5);
      var5 = this.b(var5, var6, var3, var4, this.e[9], 9);
      var4 = this.b(var4, var5, var6, var3, this.e[13], 13);
      var3 = this.b(var3, var4, var5, var6, this.e[2], 3);
      var6 = this.b(var6, var3, var4, var5, this.e[6], 5);
      var5 = this.b(var5, var6, var3, var4, this.e[10], 9);
      var4 = this.b(var4, var5, var6, var3, this.e[14], 13);
      var3 = this.b(var3, var4, var5, var6, this.e[3], 3);
      var6 = this.b(var6, var3, var4, var5, this.e[7], 5);
      var5 = this.b(var5, var6, var3, var4, this.e[11], 9);
      var4 = this.b(var4, var5, var6, var3, this.e[15], 13);
      var3 = this.c(var3, var4, var5, var6, this.e[0], 3);
      var6 = this.c(var6, var3, var4, var5, this.e[8], 9);
      var5 = this.c(var5, var6, var3, var4, this.e[4], 11);
      var4 = this.c(var4, var5, var6, var3, this.e[12], 15);
      var3 = this.c(var3, var4, var5, var6, this.e[2], 3);
      var6 = this.c(var6, var3, var4, var5, this.e[10], 9);
      var5 = this.c(var5, var6, var3, var4, this.e[6], 11);
      var4 = this.c(var4, var5, var6, var3, this.e[14], 15);
      var3 = this.c(var3, var4, var5, var6, this.e[1], 3);
      var6 = this.c(var6, var3, var4, var5, this.e[9], 9);
      var5 = this.c(var5, var6, var3, var4, this.e[5], 11);
      var4 = this.c(var4, var5, var6, var3, this.e[13], 15);
      var3 = this.c(var3, var4, var5, var6, this.e[3], 3);
      var6 = this.c(var6, var3, var4, var5, this.e[11], 9);
      var5 = this.c(var5, var6, var3, var4, this.e[7], 11);
      var4 = this.c(var4, var5, var6, var3, this.e[15], 15);
      this.d[0] += var3;
      this.d[1] += var4;
      this.d[2] += var5;
      this.d[3] += var6;
   }

   private int a(int var1, int var2, int var3, int var4, int var5, int var6) {
      int var7 = var1 + (var2 & var3 | ~var2 & var4) + var5;
      return var7 << var6 | var7 >>> 32 - var6;
   }

   private int b(int var1, int var2, int var3, int var4, int var5, int var6) {
      int var7 = var1 + (var2 & (var3 | var4) | var3 & var4) + var5 + 1518500249;
      return var7 << var6 | var7 >>> 32 - var6;
   }

   private int c(int var1, int var2, int var3, int var4, int var5, int var6) {
      int var7 = var1 + (var2 ^ var3 ^ var4) + var5 + 1859775393;
      return var7 << var6 | var7 >>> 32 - var6;
   }
}
